<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../scripts/ext-3.3.1/resources/css/ext-all.css"/>
	<link rel="stylesheet" type="text/css" href="../styles/global.css"/>
	<script type="text/javascript" src="../scripts/ext-3.3.1/adapter/ext/ext-base.js"></script>
	<script type="text/javascript" src="../scripts/ext-3.3.1/ext-all.js"></script>
	<script type="text/javascript" src="../scripts/extjs-plus.js"></script>
	<script type="text/javascript">
	Ext.onReady(function(){
		var f = new Ext.form.FormPanel({
			region:"center",			
			labelAlign:"right",
			frame:true,
			items:[
				{
					xtype:"textfield",
					name:"username",
					allowBlank:false,
					width:200,
					fieldLabel:"用户名"
				},{
					xtype:"textfield",
					name:"userpassword",
					width:200,
					allowBlank:false,
					fieldLabel:"登录密码"
				}						  
			]
		});
		var win = new Ext.Window({
			title:"管理员登录",
			width:400,
			height:150,
			modal:true,
			buttonAlign:"center",
			layout:"border",
			items:[f],
			buttons:[{
				text:"登录",
				handler:function(){
					var username = f.getForm().findField("username").getValue();
					var userpassword = f.getForm().findField("userpassword").getValue();
					Ext.Ajax.request({
						url:"<s:url action='login'/>",
						success:function(response,config){
							if(response.responseText=="\"1\""){
								window.location.href="<s:property value='#session.redirecturl'/>";
							}else{
								Ext.Msg.alert("提示",response.responseText);
							}
						},
						failure:function(response,config){
							Ext.Msg.alert("提示","系统出错！");
						},
						method:"post",
						params:{username:username,userpassword:userpassword}
					});
				}
			}]
		});
		win.show();
	});
	</script>
	<title></title>
</head>
<body>
</body>
</html>